import { createRouter, createWebHashHistory,createWebHistory } from "vue-router";
import { constantRoute } from "./routes";
const router = updateCreateRouter(constantRoute);

function updateCreateRouter(routes = constantRoute) {
  return createRouter({
    history: createWebHistory(),
    routes,
    // 滚动行为
    scrollBehavior() {
      return {
        left: 0,
        top: 0,
      };
    },
  });
}
export function resetRouter(routes = constantRoute) {
  router.replace(routes);
}
export default router;
